function C= BS_call(K,sigma,T,t,r,S)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Call option pricing via Black-Scholes formula%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Inputs:
%K--Strike Price
%r--interest rate
%sigma--volatility
%T--maturity
%t--current time
%S--Stock Price
%Outputs: C -- call option price
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Try
%BS_call(10,0.2,1,1/12,0.02,8);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PV_K = K*exp(-r*(T-t));
d1 = (log(S/K) + (r + sigma^2/2)*(T-t))./(sigma*sqrt(T-t));
d2 = d1 - sigma*sqrt(T-t);
Nd1 = normcdf(d1)*1/sqrt(2*pi);
Nd2 = normcdf(d2)*1/sqrt(2*pi);
C = Nd1.*S - Nd2.*PV_K;
end